function p = HistogramOfOpticalFlow(u, v, angle , bin)
    if angle == 180, A = ((atan( v./u )+(pi/2))*180)/pi; end
    if angle == 360, A = ((atan2(v, u)+pi)*180)/pi; end
    bin_matrix = 1:360;
    if mod(angle , bin) ~=  0
        disp('error of bin value');
    end
    step = angle / bin;
    e = 0;
    for i = 1:bin
        e= e + 1;
        bin_matrix(step * (i- 1) + 1 : step * i) = e;
    end
    A = round(A);
    zero_index = find(A == 0);
    A(zero_index) = 1;
    for i = 1 : bin
        match = find(bin_matrix(A) == i);
        p(i) = length(match);
    end
    p = p./sum(p);
end